import java.nio.ByteBuffer;

import android.media.MediaCodec;
import android.media.MediaFormat;
import android.view.Surface;

/**
 * @author zhaoshuming
 * @date 2013-5-2
 */
//public class Decoder {
//	public void decode(){
//		Surface mSurface;
//		MediaCodec codec = MediaCodec.createDecoderByType("video/avc");
//		 codec.configure(format, null, mSurface, MediaCodec.BUFFER_FLAG_SYNC_FRAME);
//		 codec.start();
//		 ByteBuffer[] inputBuffers = codec.getInputBuffers();
//		 ByteBuffer[] outputBuffers = codec.getOutputBuffers();
//		 for (;;) {
//		   int inputBufferIndex = codec.dequeueInputBuffer(timeoutUs);
//		   if (inputBufferIndex >= 0) {
//		     // fill inputBuffers[inputBufferIndex] with valid data
//		     ...
//		     codec.queueInputBuffer(inputBufferIndex, ...);
//		   }
//
//		   int outputBufferIndex = codec.dequeueOutputBuffer(timeoutUs);
//		   if (outputBufferIndex >= 0) {
//		     // outputBuffer is ready to be processed or rendered.
//		     ...
//		     codec.releaseOutputBuffer(outputBufferIndex, ...);
//		   } else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
//		     outputBuffers = codec.getOutputBuffers();
//		   } else if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
//		     // Subsequent data will conform to new format.
//		     MediaFormat format = codec.getOutputFormat();
//		     ...
//		   }
//		 }
//		 codec.stop();
//		 codec.release();
//		 codec = null;
//	}
//}
